/*

Author   : chaos

FileName : static_member.cpp

Date     : 12/08/17 12:47:25

*/
#include <iostream>
#include <cstring>
using namespace std;

class Book
{
    private:
        static int book_num;
        char name[30];
    public:
        Book(const char * i_name)
        {
            book_num += 1;
            strcpy(name,i_name);
        }

        ~Book()
        {
            book_num -= 1;
        }

        static int get_book_num_static()
        {
            return book_num;
        }

        int get_book_num()
        {
            return book_num;
        }
};

int Book::book_num = 0;

int main(int argc ,char *argv[])
{
    Book A_Book("The C++ Bible");

    cout << "A_Book.get_book_num() :";
    cout << A_Book.get_book_num() << endl;

    cout << "A_Book.get_book_num_static() : "
        << A_Book.get_book_num_static() << endl;

    cout << "Book::get_book_num_static():"
        << Book::get_book_num_static() << endl;

    return 0;
}
